package org.jground.rx.ui.zk;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jground.rx.ui.zk.docu.UIDocuUtils;
import org.jground.rx.ui.zk.viewControl.UIAttributeViewControlFactory;
import org.jground.rx.web.RXInitServlet;
import org.jground.util.StringUtils;

public class UIInitializer {
    private static Log logger = LogFactory.getLog(UIInitializer.class);
    public UIInitializer(String[] uiWidgetRegisterStrings){
        for (String registerString : uiWidgetRegisterStrings) {
            if (StringUtils.isNotBlank(registerString)) {
                try {
                    UIAttributeViewControlFactory.register(registerString.trim());
                } catch (Exception e) {
                    logger.error(e, e);
                }
            }
        }
        //
        // INIT UIStyles
        //
        UIStyles.getInstance().initIcons(RXInitServlet.IMAGE_REAL_DIR, RXInitServlet.imageDirValue);
        //
        // DOCU WIDGET REGISTRATION
        //
        UIDocuUtils.registerUI();
    }
}
